AddCSLuaFile("cl_init.lua");
AddCSLuaFile("shared.lua");

include("shared.lua");

-- Called when the SENT is spawned.
function ENT:Initialize()
    self:SetModel("models/items/item_item_crate.mdl")
 	self:PhysicsInit(SOLID_VPHYSICS);
	self:SetMoveType(MOVETYPE_VPHYSICS);
	self:SetSolid(SOLID_VPHYSICS);
 	self:SetColor(255, 255, 255, 255);
	
 	self.Type = "Resource";
 	self.Amount = 0;
end;

-- Called when an entity starts touching this SENT.
function ENT:StartTouch(entity)
	if (entity:GetClass() == "gms_resourcedrop" and entity.Type == self.Type) then
		GAMEMODE:MergeResources(self, entity);
	end;
	
	if (entity:GetClass() == "gms_buildsite" and (entity.Costs[self.Type] != nil and entity.Costs[self.Type] > 0)) then
		GAMEMODE:ApplyBuildsiteResources(self, entity);
	end;
end;